

const initialState ={
    num:1,
    list:[1,2,3],
    flag:false,
    arr:[]
}


export default (state = initialState, { type, payload }) => {
    let {flag,num,arr}=state
    switch (type) {
    case 'DIAN':
        flag=true
        return{
            ...state,
            flag:flag
        }
  case "ADDNUM":
      num++
    return { 
        ...state,
        num
    }
    case "SET_ARR":
     arr=payload
      return { 
          ...state,
          arr
      }
  default:
    return state
  }
}
